package com.thrd.taiexhibition.model;

import com.alibaba.fastjson.JSON;
import com.thrd.basicframework.http.OkHttpUtils;
import com.thrd.basicframework.http.callback.ThrdCallBack;
import com.thrd.taiexhibition.bean.BeanResearch;
import com.thrd.taiexhibition.callback.MvpCallback;
import com.thrd.taiexhibition.utils.Constant;

import java.util.List;

/**
 * 有聊调研
 * @author: ${唐杰}
 * @date: 2021/3/30
 */
public class ResearchModel {
    public static final String TAG="FocusIndustryImageModel";


    /**
     * 获取城市首页
     */
    public void getResearchData(final MvpCallback<List<BeanResearch>> mvpCallback) {
        OkHttpUtils.get().url(Constant.HTTP_RESEARCH)
                .tag(TAG)
                .build().execute(new ThrdCallBack<List<BeanResearch>>() {
            @Override
            public void onFailed(String e, int code) {
                mvpCallback.onFailed(e, code);
            }

            @Override
            public void onResponse(List<BeanResearch> response, int id) {
                mvpCallback.onSuccess(response);
            }

            @Override
            public List<BeanResearch> onJson(String s) {
                return JSON.parseArray(s, BeanResearch.class);
            }


        });
    }

}
